﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ControlHeader.ascx.cs"
    Inherits="LosConn.Web.Control.ControlHeader" %>
<div id="header">
    <h1>
        <a href="#">优视唯康</a>
    </h1>
</div>
<div id="user-nav" class="navbar navbar-inverse">
    <ul class="nav btn-group">
        <li class="btn btn-inverse"><a title="帐户信息" href="#User_RetailInfo" data-toggle="modal">
            <i class="icon icon-user"></i><span class="text">帐户信息</span> </a></li>
        <li class="btn btn-inverse"><a title="修改密码" href="#UpdatePassWord" data-toggle="modal">
            <i class="icon icon-cog"></i><span class="text">修改密码</span> </a></li>
        <li class="btn btn-inverse"><a title="" href="/Loginout.aspx"><i class="icon icon-share-alt">
        </i><span class="text">退出系统</span> </a></li>
    </ul>
</div>
<!-- Modal -->
<form runat="server" id="form3">
<div id="User_RetailInfo" class="modal hide fade" tabindex="-1">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
            ×</button>
        <h3>
            帐户信息</h3>
    </div>
    <div class="modal-body">
        <p class="amount-word">
            账户余额： <span>
                <%=modelRetail.Retail_Money %></span>
        </p>
        <p class="amount-word">
            电话： <span>
                <%=model.User_Phone %></span>
        </p>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">
            关闭</button>
    </div>
</div>
</form>
<form id="PassWord" class="form-horizontal formModal" novalidate="novalidate">
<div id="UpdatePassWord" class="modal hide fade" tabindex="-1">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
            ×</button>
        <h3>
            修改密码</h3>
    </div>
    <div class="modalBody">
        <div class="control-group">
            <label class="control-label" for="User_Name">
                用户账号</label>
            <div class="controls">
                <label id="User_Name" class="top-pad" runat="server">
                </label>
                <input id="User_ID" value="<%=User_ID %>" type="hidden" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="User_PassWord">
                当前密码</label>
            <div class="controls">
                <input type="password" name="User_oldPassWord" required />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="User_PassWord">
                新密码</label>
            <div class="controls">
                <input type="password" name="User_PassWord" required />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="User_PassWord">
                确认新密码</label>
            <div class="controls">
                <input type="password" data-validation-match-match="User_PassWord" data-validation-match-message="两次输入的密码不一致。" />
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button type="submit" class="btn btn-primary" data-loading-text="提交中..." autocomplete="off">
            <i class="icon-wrench icon-white"></i>提交
        </button>
    </div>
</div>
</form>
<script>
    //修改用户密码表单验证
    $("#PassWord").find("input,select").jqBootstrapValidation({
        preventSubmit: true,
        submitSuccess: function ($form, event) {
            $.ajax({
                url: "/Handler/UserHandler.ashx",
                type: "post",
                dataType: "json",
                data: {
                    fun: "f_0004",
                    id: $("#User_ID").val(),
                    data: JSON.stringify($("#PassWord").serializeObject())
                },
                beforeSend: function () {
                    //数据加载冻屏
                    $form.find("button[type=submit]").button('loading');
                },
                success: function (msg) {
                    //数据加载完毕解除冻屏
                    $form.find("button[type=submit]").button('reset');
                    if (msg.r_code == "1") {
                        toastr.success(msg.r_info, '系统提示：');
                        //清空form表单
                        $form.get(0).reset();
                        $form.parent().modal('hide');
                        $form.parent().remove();
                        //刷新页面
                        setTimeout(function () {
                            window.location.href = window.location.href;
                        }, 1000);
                    } else if (msg.r_code == "0") {
                        toastr.error(msg.r_info, '错误提示：');
                    }
                }
            });
            event.preventDefault();
        },
        filter: function () {
            return $(this).is(":visible");
        }
    });
</script>
